{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "value =  1.493648265624854\n",
      "err   =  1.6582826951881447e-14\n"
     ]
    }
   ],
   "source": [
    "import sympy\r\n",
    "from scipy import integrate\r\n",
    "import numpy as np\r\n",
    "import mpmath\r\n",
    "\r\n",
    "def f(x):\r\n",
    "    return np.exp(-x**2)\r\n",
    "\r\n",
    "val,err= integrate.quad(f,-1,1)\r\n",
    "print('value = ',val)\r\n",
    "print('err   = ',err)\r\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[           inf 1.02416485e-04 5.12086603e-05 3.41395713e-05\n",
      " 2.56051661e-05 2.04846345e-05 1.70710397e-05 1.46328373e-05\n",
      " 1.28042552e-05 1.13820867e-05 1.02444077e-05 9.31363008e-06\n",
      " 8.53802860e-06 7.88179337e-06 7.31934591e-06 6.83192868e-06\n",
      " 6.40547352e-06 6.02922244e-06 5.69480810e-06 5.39562471e-06\n",
      " 5.12638765e-06 4.88281886e-06 4.66141815e-06 4.45929405e-06\n",
      " 4.27403698e-06 4.10362291e-06 3.94633921e-06 3.80072696e-06\n",
      " 3.66553565e-06 3.53968727e-06 3.42224753e-06 3.31240272e-06\n",
      " 3.20944082e-06 3.11273612e-06 3.02173652e-06 2.93595304e-06\n",
      " 2.85495101e-06 2.77834275e-06 2.70578140e-06 2.63695567e-06\n",
      " 2.57158541e-06 2.50941778e-06 2.45022405e-06 2.39379673e-06\n",
      " 2.33994723e-06 2.28850370e-06 2.23930924e-06 2.19222031e-06\n",
      " 2.14710533e-06 2.10384345e-06 2.06232350e-06 2.02244303e-06\n",
      " 1.98410746e-06 1.94722936e-06 1.91172777e-06 1.87752763e-06\n",
      " 1.84455921e-06 1.81275772e-06 1.78206280e-06 1.75241820e-06\n",
      " 1.72377142e-06 1.69607340e-06 1.66927823e-06 1.64334295e-06\n",
      " 1.61822726e-06 1.59389334e-06 1.57030566e-06 1.54743084e-06\n",
      " 1.52523744e-06 1.50369583e-06 1.48277810e-06 1.46245790e-06\n",
      " 1.44271034e-06 1.42351192e-06 1.40484037e-06 1.38667463e-06\n",
      " 1.36899476e-06 1.35178183e-06 1.33501790e-06 1.31868593e-06\n",
      " 1.30276974e-06 1.28725393e-06 1.27212389e-06 1.25736566e-06\n",
      " 1.24296600e-06 1.22891225e-06 1.21519237e-06 1.20179485e-06\n",
      " 1.18870873e-06 1.17592350e-06 1.16342917e-06 1.15121614e-06\n",
      " 1.13927527e-06 1.12759779e-06 1.11617530e-06 1.10499976e-06\n",
      " 1.09406348e-06 1.08335906e-06 1.07287943e-06 1.06261777e-06]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-28-7cdbf2b4ddec>:19: RuntimeWarning: divide by zero encountered in true_divide\n",
      "  beta=KsubB*X0/(np.pi*(Ve+Va)*np.sin(phi))\n"
     ]
    }
   ],
   "source": [
    "import sympy\r\n",
    "from scipy import integrate\r\n",
    "import numpy as np\r\n",
    "import mpmath\r\n",
    "import matplotlib.pyplot as plt\r\n",
    "import matplotlib as mpl\r\n",
    "## 所以在python里面是弧度制还是角度制\r\n",
    "## \r\n",
    "## 1弧度约为57.3° 90°等于pi/2弧度\r\n",
    "# x=np.linspace(0,2*np.pi,100)\r\n",
    "# y=np.sin(x)\r\n",
    "# plt.scatter(x,y)\r\n",
    "\r\n",
    "phi=np.linspace(0,0.4,100)\r\n",
    "gamma= 1.2    # d/(2*b)*np.sin(phi)\r\n",
    "Ve=1.\r\n",
    "Va=1.\r\n",
    "KsubB=2.6e-6\r\n",
    "X0=1. #不知道哪里的参数\r\n",
    "beta=KsubB*X0/(np.pi*(Ve+Va)*np.sin(phi))\r\n",
    "# print(beta)\r\n",
    "\r\n",
    "np.log(1+x*np.square(1-y**2))\r\n",
    "\r\n",
    "QQ0=2/(np.pi*beta*gamma) *[gamma*F(2*beta)+G1(beta)+G_1(beta)-G_0(2*beta)]\r\n",
    "\r\n"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c520093fc6bc793f6e0c2459e0ff5f4f2e71abb36a49a9462ee5c691d1f820d9"
  },
  "kernelspec": {
   "display_name": "Python 3.9.5 64-bit",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}